const api = require("../../../utils/cloudAPIUtils");
const app = getApp;

Page({
    data: {
        orderInfo:{},
    },
    btnPlaceNavigation(){
        const info = this.data.orderInfo;
        wx.openLocation({
        latitude: info.latitude,
        longitude: info.longitude,
        name: info.placeName,
        address: info.placeAddress
        })
    },
    btnScan() {
        wx.scanCode({
            success(res) {
                //保留当前页跳转
                wx.navigateTo({
                    url: "/pages/guide/guide?q=" + res.result,
                })
            }
        })
    },
    onLoad(options) {
        const self = this;
        console.log(options)
        api.post(api.url.orderInfo,{
            tradeNo:options.tradeNo
        },res=>{
        console.log(res)
        if(res.data.code==200){
            self.setData({
            orderInfo:res.data.body
            })
        }else{
            wx.showModal({
                title: '错误订单',
                content: res.data.msg,
                showCancel:false,
                success(){
                    wx.navigateBack();
                }
            })
        }
        })
    },
})